<!DOCTYPE html>
<html>

	<head>
		<title>深圳市消消乐有害生物防治有限公司-产品与服务</title>
		<meta charset="UTF-8" />
		<script type="text/javascript" src="js/swiper.min.js"></script>
		<link rel="stylesheet" href="css/swiper.min.css" />
		<link rel="stylesheet" href="css/bootstrap.min.css" />
		<link rel="stylesheet" href="css/style.css" />
		<script type="text/javascript" src="js/jquery-3.4.1.min.js"></script>
		<script src="js/xs.js"></script>
		<script type="text/javascript" src="js/global.js"></script>
		<script type="text/javascript" src="js/pages.js"></script>
	</head>

	<body>

		<div class="container bg-white">
			<div id="head"></div>
			<div class="banner row">
				<div>
					<img src="img/pro_banner.jpg" width="100%" />
				</div>
			</div>

			<div class="row" style="margin-top: 20px;">
				<div class="col-sm-3 col-xs-12 p-0">
					<div class="card">
						<div class="cardHead">
							<div class="float-left">
								<img class="float-left" src="img/zxq3.jpg" / style="margin-top: 7px;margin-right: 3px;">
								<div class="titleIco float-left">产品与服务</div>
							</div>
						</div>
						<div class="cardBody">
							<ul id="navList" class="list-group list-group-flush"></ul>
						</div>
					</div>
					<div class="card" style="margin-top: 15px;">
						<div class="cardHead">
							<div class="float-left">
								<img class="float-left" src="img/zxq3.jpg" / style="margin-top: 7px;margin-right: 3px;">
								<div class="titleIco float-left">联系我们</div>
							</div>
						</div>
					<div id="contact2" class="cardBody p-3 c666" style="background: url(img/20130530101646794679.jpg) right bottom no-repeat;min-height: 200px;line-height: 25px;">
					</div>
					</div>
				</div>
				<div class="col-sm-9 col-xs-12 p-0">
					<div class="card" style="margin-left: 20px;">
						<div class="cardHead">
							<div class="float-left">
								<img class="float-left" src="img/zxq3.jpg" / style="margin-top: 7px;margin-right: 3px;">
								<div class="titleIco float-left">全部产品</div>
							</div>
						</div>
						<div class="cardBody container-fluid row" style="width: auto;" id="projectList"></div>
						<div style="padding: 50px;">

							<div id="buttonContainer">
							</div>

						</div>

					</div>

				</div>
				<div id="foot"></div>
			</div>

			<div class="scrollsidebar" id="scrollsidebar"></div>

		</div>
		<script>
			var pId = getUrlParam("pId")
			var nId = getUrlParam("nId")

			var pageSize = 100;
			var pageNum = 1;

			$.ajax({
				type: "POST",
				async: false,
				url: baseURL + "lable/queryWebLableList.do",
				data: {
					pId: pId
				},
				dataType: "json",
				success: function(res) {

					//三级分类
					res.data.forEach((item, index) => {
						$("#navList").append(`<li class="list-group-item"><div class="nav2List"><img src="./img/maximize.png"><span>${item.lableName}</span></div></li>`)

						$("#navList>li").eq(index).append(`<ul class="list-group nav3List list-group-flush p-l-20"></ul>`)
						getNavList(item, index)

					})

					if(nId) {
						getData(res.data[0].id)
					} else {
						$.ajax({
							type: "POST",
							async: false,
							url: baseURL + "article/queryAllArticleByPId.do",
							data: {
								pId: "4",
								isShow: "1"
							},
							dataType: "json",
							success: function(res2) {
								console.log({
									默认产品: res2
								})
								if(res2.data.length > 0) {
									$("#articleList").html("")
									res2.data.forEach(items => {
										$("#projectList").append(`<a href="./project.html?pId=${pId}&nId=4&aId=${items.id}" class="col-3 p-0" style="margin-top: 20px;"><div class="proItem"><img src="${JSON.parse(items.imageUrl)[0]}" width="100%" height="100%"/></div><p class="proItemTxt">${items.title}</p></a>`)
									})
								}
							}
						});
					}
					

				}
			});

			//			获取三级栏目
			function getNavList(item, index) {
				$.ajax({
					type: "POST",
					async: false,
					url: baseURL + "lable/queryWebLableList.do",
					data: {
						pId: item.id
					},
					dataType: "json",
					success: function(ress) {
						console.log({
							三级分类: ress
						})

						if(ress.data.length > 0) {
							ress.data.forEach((items, indexs) => {
								$("#navList>li").eq(index).find("ul").append(`<li class="list-group-item"><a href="./projectList.html?pId=${pId}&nId=${items.id}">${items.lableName}</a></li>`)
							})
						} else {
							$("#navList>li").eq(index).find("ul").append(`<li class="list-group-item"><a href="./projectList.html?pId=${pId}&nId=${item.id}">${item.lableName}</a></li>`)
						}

					}
				});

			}

			//			获取产品
			function getData(goodsId) {
				$.ajax({
					type: "POST",
					async: false,
					url: baseURL + "article/queryList.do",
					data: {
						lableId: nId ? nId : goodsId,
						pageSize: pageSize,
						pageNo: pageNum
					},
					dataType: "json",
					success: function(res) {
						console.log({
							查询产品: res
						})
						if(res.data.list.length > 0) {
							$("#articleList").html("")
							res.data.list.forEach(items => {
								$("#projectList").append(`<a href="./project.html?pId=${pId}&nId=4&aId=${items.id}" class="col-3 p-0" style="margin-top: 20px;"><div class="proItem"><img src="${JSON.parse(items.imageUrl)[0]}" width="100%" height="100%"/></div><p class="proItemTxt">${items.title}</p></a>`)
							})
						}

					}
				});
			}

			$(".nav2List").click(function() {
				$(this).next().fadeToggle()
			})
		</script>
	</body>

</html>